
# print(eval('13+2/2+4*2-2'))
s = "13+2/2+4*2-2"
def func(v):
    nums = []
    ops = []
    m = ""
    for i in v:
        if i in "+-*/":
            nums.append(int(m))
            m = ""
            ops.append(i)
        else:
            m+=i
    nums.append(int(m))
    return nums, ops

def func1(nums, ops, op="*/"):
    m = 0
    while m < len(ops):
        if ops[m] in op:
            if ops[m] == "*":
                nums[m] = nums[m]* nums[m+1]
            elif ops[m] == '/':
                nums[m] = nums[m] * nums[m + 1]
            elif ops[m] == "+":
                nums[m] = nums[m] + nums[m + 1]
            elif ops[m] == '-':
                nums[m] = nums[m] - nums[m + 1]
            nums.pop(m + 1)
            ops.pop(m)
        else:
            m+=1
    return nums, ops



if __name__ == '__main__':
    nums, ops = func(s)
    nums, ops = func1(nums, ops)
    nums, ops = func1(nums, ops, "+-")
    print(nums[0])

